From 7bf6095d73d2117f4ebc60419a9cf809f9072738 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 14 Nov 2004 02:24:44 +0000 Subject: [PATCH] Fix UTF-8 validation bug where some cases didn't get replacement chars inserted correctly --- includes/normal/CleanUpTest.php | 26 ++++++++++++++++++++++++++ includes/normal/UtfNormal.php | 1 - 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/includes/normal/CleanUpTest.php b/includes/normal/CleanUpTest.php index 64f7b63904..2dd8d5616f 100644 --- a/includes/normal/CleanUpTest.php +++ b/includes/normal/CleanUpTest.php @@ -1,4 +1,8 @@ assertEquals( + bin2hex( $expect ), + bin2hex( UtfNormal::cleanUp( $text ) ) ); + } } diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 2883342f8e..7dd9072185 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -350,7 +350,6 @@ class UtfNormal { $replace[] = array( UTF8_REPLACEMENT, $base + $i + 1 - strlen( $sequence ), strlen( $sequence ) ); - $base += $chunk; break 2; } else { # Illegal tail byte; abandon the sequence. -- 2.20.1